
import java.util.*;
public class Main {
    public static void main(String[] args) {

        Student student = new Student();
        student.setName("zhangfei") ;
        System.out.println(student.getName());
        Student student2 = new Student("zhangfei",99);

    }
    public static void main1(String[] args) {
        Student student1 = new Student();
        System.out.println("=====");
        Student student2 = new Student();
    }
}
class Student {
    //成员变量：定义在方法的外部，类的内部！

    //普通成员变量/实例成员变量
    private String name;//姓名
    private int age;//年龄

    //静态成员变量
    public static String classRoom;

    {
        this.name = "xiaoli";
        this.age = 19;
        System.out.println("实例代码块！");
    }

    static {
        classRoom = "109";
        System.out.println("静态代码块！1");
    }

    static {
        classRoom = "888";
        System.out.println("静态代码块！2");
    }

    public Student() {
        System.out.println("不带参数的构造方法");
    }

    public Student(String name) {
        this.name = name;
    }

    public Student(String name, int age) {
        this.name = name;
        this.age = age;
    }
    /**/
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    //成员方法
    public void stu() {
        System.out.println(this.name +" 正在学习！");
        //this.show();
    }

    public void show() {
        //func();
        System.out.println("姓名："+this.name +" 年龄："+this.age);
    }

    @Override
    public String toString() {
        return "姓名："+this.name +" 年龄："+this.age;
    }

    public static void func() {
        System.out.println("这是一个静态方法！！");
        //show(); 静态方法内部 不能直接调用非静态方法
        /*Student student = new Student();
        student.show();*/
    }

}